table.UPDATE Function
Syntax
Arguments
- Update.fields
Type "N". Specifies how many fields are to be updated.
- Update.field1 ... Update.fieldN
Type "C". Fields (1 ... N) containing the names of the fields to be updated.
- Expr1 ... ExprN
Type "C". Fields (1 ... N) containing the value or expression used to update the field.
Description
Update all records in table using expressions.
Discussion
The <TBL>.UPDATE() method is a high-level utility used to globally update the records of a specified table. You perform an Update operation on the table referenced by the <TBL> pointer. Each Update operation is defined on a field-by-field basis. Field mappings consists of a Fieldname and an associated Update expression. All of the currently selected records are updated (i.e., the active range, index, or query).
Example
This script is used to update the ON_HAND and STATUS fields in a table for all records that satisfy a filter condition.
tbl = table.open("products") 'Define a query so that only selected records are updated. query.filter = "TYPE = 'Camping'" query.order = "" query.options = "" indx = tbl.query_create() update.fields = 2 update.field1 = "ON_HAND" update.expr1 = "0" update.field2 = "STATUS" update.expr2 = " 'Discontinued' " tbl.update()
See Also